package com.karaoke.android.library.mvvm

import android.app.Activity
import android.databinding.DataBindingUtil
import android.databinding.ViewDataBinding
import android.os.Bundle
import com.karaoke.android.library.mvvm.ActivityViewModel
import com.karaoke.android.library.mvvm.BindingConfig

/**
 * Created by Administrator on 2016/12/1.
 */

abstract class MvvmActivity<out B : ViewDataBinding, out VM : ActivityViewModel> : AbstractActivity()
{

    abstract val viewModel: VM
    abstract val dataBinding: B

    override fun onCreate(savedInstanceState: Bundle?)
    {
        super.onCreate(savedInstanceState)
        setContentView(dataBinding.root)
        viewModel.onCreate()
    }

    override fun onResume()
    {
        super.onResume()
        viewModel.onResume()
    }

    override fun onStart()
    {
        super.onStart()
        viewModel.onStart()
    }

    override fun onStop()
    {
        super.onStop()
        viewModel.onStop()

    }

    override fun onPause()
    {
        super.onPause()
        viewModel.onPause()
    }

    override fun onDestroy()
    {
        super.onDestroy()
        viewModel.onDestroy()
    }
}
